package com.galaxis.wms.security.utils;

import com.galaxis.wms.entity.BasUser;
import com.yvan.core.DbConv;
import com.yvan.security.model.UserInfo;

/**
 * 作者：lizw <br/>
 * 创建时间：2021/12/16 16:28 <br/>
 */
public class UserInfoConvertUtils {
    public static final String USER_CODE = "userCode";

//    public static UserInfo convertToUserInfo(SysUser user) {
//        if (user == null) {
//            return null;
//        }
//        UserInfo userInfo = new UserInfo();
//        userInfo.setUserId(DbConv.asString(user.getUserId()));
//        userInfo.setUserName(user.getUserName());
//        userInfo.getExt().put(USER_CODE, user.getUserCode());
//        return userInfo;
//    }

    public static UserInfo convertToUserInfo(BasUser user) {
        if (user == null) {
            return null;
        }
        UserInfo userInfo = new UserInfo();
        userInfo.setUserId(DbConv.asString(user.getUserId()));
        userInfo.setUserName(user.getUserName());
        userInfo.getExt().put(USER_CODE, user.getUserCode());
        return userInfo;
    }
}
